// #include <Arduino.h>
// #include <lvgl.h> /* https://github.com/lvgl/lvgl.git */
// #include "rm67162.h"

// #if ARDUINO_USB_CDC_ON_BOOT != 1
// #warning "If you need to monitor printed data, be sure to set USB CDC On boot to ENABLE, otherwise you will not see any data in the serial monitor"
// #endif

// #ifndef BOARD_HAS_PSRAM
// #error "Detected that PSRAM is not turned on. Please set PSRAM to OPI PSRAM in ArduinoIDE"
// #endif

// static lv_disp_draw_buf_t draw_buf;
// static lv_color_t *buf;

// void my_disp_flush(lv_disp_drv_t *disp,
//                    const lv_area_t *area,
//                    lv_color_t *color_p) {
//   uint32_t w = (area->x2 - area->x1 + 1);
//   uint32_t h = (area->y2 - area->y1 + 1);
//   lcd_PushColors(area->x1, area->y1, w, h, (uint16_t *)&color_p->full);
//   lv_disp_flush_ready(disp);
// }

// void setup() {
//   screen.init();  // 屏幕初始化

//   lv_init();

//   buf = (lv_color_t *)ps_malloc(sizeof(lv_color_t) * LVGL_LCD_BUF_SIZE);
//   assert(buf);


//   lv_disp_draw_buf_init(&draw_buf, buf, NULL, LVGL_LCD_BUF_SIZE);

//   /*Initialize the display*/
//   static lv_disp_drv_t disp_drv;
//   lv_disp_drv_init(&disp_drv);
//   /*Change the following line to your display resolution*/
//   disp_drv.hor_res = EXAMPLE_LCD_H_RES;
//   disp_drv.ver_res = EXAMPLE_LCD_V_RES;
//   disp_drv.flush_cb = my_disp_flush;
//   disp_drv.draw_buf = &draw_buf;
//   lv_disp_drv_register(&disp_drv);

//   lv_obj_t *label1 = lv_label_create(lv_scr_act());
//   lv_label_set_long_mode(label1, LV_LABEL_LONG_WRAP); /*Break the long lines*/
//   lv_label_set_recolor(label1, true);                 /*Enable re-coloring by commands in the text*/
//   lv_label_set_text(label1, "#0000ff Re-color# #ff00ff words# #ff0000 of a# label, align the lines to the center "
//                             "and wrap long text automatically.");
//   lv_obj_set_width(label1, 150); /*Set smaller width to make the lines wrap*/
//   lv_obj_set_style_text_align(label1, LV_TEXT_ALIGN_CENTER, 0);
//   lv_obj_align(label1, LV_ALIGN_CENTER, 0, -40);

//   lv_obj_t *label2 = lv_label_create(lv_scr_act());
//   lv_label_set_long_mode(label2, LV_LABEL_LONG_SCROLL_CIRCULAR); /*Circular scroll*/
//   lv_obj_set_width(label2, 150);
//   lv_label_set_text(label2, "It is a circularly scrolling text. ");
//   lv_obj_align(label2, LV_ALIGN_CENTER, 0, 40);
// }

// void loop() {
//   lv_timer_handler();
//   delay(2);
// }

#include "Screen.h"

Screen screen;  // 屏幕

void setup() {
  Serial.begin(115200);              // 设置波特率
  screen.init();                     // 屏幕初始化
  // screen.spr.loadFont(snowflake28);  // 加载自定义中文字库
  screen.textWhite();
  screen.drawString("Loading...", 120, 300);  // Loading
  screen.drawScreen();                        // 渲染
}
